<template>
	<view class="layout">
		<text class="words" :style="{'-webkit-line-clamp': maxlines}">
			别跟傻瓜吵架，\n
			不然旁人会搞不清楚，\n
			到底谁是傻瓜。\n
			别跟傻瓜吵架，\n
			不然旁人会搞不清楚，\n
			到底谁是傻瓜。\n
			别跟傻瓜吵架，\n
			不然旁人会搞不清楚，\n
			到底谁是傻瓜。
		</text>
		<view class="infos">
			<view class="line"></view>
			<view class="outer">
				<view class="desc">
					<view class="pic">
						<image class="img" src="@/static/logo.png" mode="aspectFill"></image>
					</view>
					<view class="nick">张三</view>
					<view class="from">摘自：红楼梦</view>
				</view>
				<view class="nums" v-if="showNumbers">共33人看过</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	defineProps({
		maxlines: {
			type: [String, Number],
			default: 'none'
		},
		showNumbers: {
			type: String,
			default: false
		}
	})
</script>

<style lang="scss" scoped>
	@mixin maxline($row: none) {
		/* 将元素作为块状容器 */
		display: -webkit-box;
		/* 限制显示的最大行数为3行 */
		-webkit-line-clamp: $row;
		/* 设置子元素垂直布局 */
		-webkit-box-orient: vertical;
		/* 超出容器范围的内容不显示 */
		overflow: hidden;
	}

	.layout {
		.words {
			font-size: 50rpx;
			font-weight: lighter;
			width: 100%;
			line-height: 1.8em;
			margin-top: 10rpx;
			margin-bottom: 60rpx;
			@include maxline()
		}

		.infos {

			.line {
				width: 70rpx;
				height: 5rpx;
				background-color: #f0f0f0;
				margin-bottom: 30rpx;
			}

			.outer {
				display: flex;
				align-items: center;
				justify-content: space-between;

				.desc {
					display: flex;
					align-items: center;
					font-size: 26rpx;
					color: #888;

					.pic {
						width: 40rpx;
						height: 40rpx;

						.img {
							width: 100%;
							height: 100%;
						}
					}

					.nick {
						padding-left: 12rpx;
					}

					.from {
						padding-left: 12rpx;
					}
				}

				.nums {
					font-size: 26rpx;
					color: #999;
				}
			}
		}
	}
</style>